package com.class05.configuration;

import com.class05.condition.CatCondition;
import com.class05.condition.DogCondition;
import com.class05.pojo.Cat;
import com.class05.pojo.Dog;
import com.class05.pojo.Pet;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PetConfiguration {

    @Bean
    @Conditional(DogCondition.class)
    public Pet dog() {
        return new Dog();
    }

    @Bean
    @Conditional(CatCondition.class)
    public Pet cat() {
        return new Cat();
    }
}